//
//  DataModelController.m
//  JiaoWuGuanLi
//
//  Created by Zinzie on 14-2-10.
//  Copyright (c) 2014年 Zinzie. All rights reserved.
//

#import "DataModelController.h"
#import "DataModel.h"

@interface DataModelController ()
-(void)initDefaultList;
@end
@implementation DataModelController

-(void)setChengJiList:(NSMutableArray *)chengJiList{
    if (_chengJiList != chengJiList) {
        _chengJiList = [chengJiList mutableCopy];
    }
}

-(id)init{
    if (self = [super init]) {
        [self initDefaultList];
        return self;
    }
    return nil;
}

-(void)initDefaultList{
    NSMutableArray *list = [[NSMutableArray alloc]init];
    self.chengJiList = list;
    DataModel *default1 = [[DataModel alloc]initWithName:@"数字信号处理"
                                                    mark:@"78"
                                                  jidian:@"3"
                                               attribute:@"学科基础必修课"
                                                  number:@"9999999"
                                                 teacher:@"张三"
                                                    year:@"2013-2014"
                                                    term:@"1"
                                                  xueFen:@"3.0"
                                                 xueYuan:@"电子信息与控制工程学院"];
    DataModel *default2 = [[DataModel alloc]initWithName:@"通信原理"
                                                    mark:@"89"
                                                  jidian:@"3"
                                               attribute:@"专业必选课"
                                                  number:@"0000000"
                                                 teacher:@"李四"
                                                    year:@"2012-2013"
                                                    term:@"1"
                                                  xueFen:@"3.5"
                                                 xueYuan:@"电子信息及控制工程学院"];
    [self addchengjiListWithChengji:default1];
    [self addchengjiListWithChengji:default2];
}

-(NSUInteger)countOfChengJiList{
    return [self.chengJiList count];
}

-(DataModel *)objectInChengJiListAtIndex:(NSUInteger)index{
    return [self.chengJiList objectAtIndex:index];
}

-(void)addchengjiListWithChengji:(DataModel *)chengJi{
    [self.chengJiList addObject:chengJi];
}

@end
